<?php
class RestController extends Zend_Rest_Controller {
	
	private $data = array ();
	
	public function init() {
		$this->data = array (array ('address1', '1234', 'james', '10000' ), array ('address2', '1234', 'alex', '32342' ), array ('address3', '4223', 'tom', '42323' ), array ('address4', '44345', 'jerry', rand ( 10000, 20000 ) ), array ('address5', '54334', 'kevin', rand ( 10000, 20000 ) ), array ('address6', '3232', 'joey', '123213' ), array ('address7', '1234', 'may', rand ( 10000, 20000 ) ), array ('address8', '1234', 'mary', '10000' ), array ('address9', '243435', 'carin', '37823' ), array ('address10', '4543223', 'rebecca', rand ( 10000, 20000 ) ), array ('address11', '43343', 'leo', '123430' ), array ('address12', '54345', 'peter', rand ( 10000, 20000 ) ), array ('address13', '889667', 'gary', rand ( 10000, 20000 ) ) );
		$this->_helper->viewRenderer->setNoRender ( true );
		$this->_helper->getHelper ( 'layout' )->disableLayout (); //template disabled
	}
	
	public function indexAction() {
		$address = $this->_getParam ( "address" );
		$postcode = $this->_getParam ( "postcode" );
		echo Zend_Json::encode ( $this->find ( $address, $postcode ) );
		$this->getResponse ()->setHttpResponseCode ( 500 );
		//		$this->getResponse()
	//            ->appendBody("From indexAction() returning all articles");
	}
	
	private function find($address, $postcode) {
		$ret = array ();
		$randIndex = rand ( 0, 12 );
		$row = $this->data [$randIndex];
		$ret [0] = $row [2];
		$ret [1] = $row [3];
		return $ret;
	}
	
	public function getAction() {
	}
	
	public function postAction() {
	}
	
	public function putAction() {
	}
	
	public function deleteAction() {
	}
}